<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta content="App Inventor for Android" name="description">
    <meta content="Android, Blocks App Inventor, Mobile, Phone, IDE" name="keywords">
    <title>
      Basic Components - App Inventor for Android
    </title>
    <link href="../../../static/images/appinventor-16.png" rel="SHORTCUT ICON" type="image/ico">
    <link href="../../../static/images/appinventor-16.png" rel="icon" type="image/png">
    <link href="../../../static/css/appinventor.css" rel="stylesheet" type="text/css">
<!-- ADD Google Analytics here -->
<!-- END Google Analytics here -->
    <style type="text/css">
img.c3 {border-width:0}
    code.c2 {font-style: italic}
    div.c1 {clear:both;}
    </style>
  </head>
  <body>
    <div id="aiac">
      <div class="main-container">
        <div class="header">
          <div class="header-title">
            <a href="../../../about/index.html"><img alt="" src="../../../static/images/appinventor_logo.gif"></a>
          </div>
            <div class="header-search">
<!-- ADD Google Custom Search -->
<!-- END Google Custom Search -->
              <div class="header-search-query">
              </div>
              <div class="header-search-button">
              </div>
            </div>
          <div class="header-login">
            <div class="header-login-greeting">
              Learn about App Inventor
            </div>
          </div>
        </div>
        <div class="customhr customhr-green"></div>
<!-- ADD Google Search Results -->
<!-- END Google Search Results -->
        <div id="navigation">
          <div id="navigation-links">
            <div class="navigation-link-option" id="navigation-link-home">
              <a href="../../../about/index.html">About</a>
            </div>
            <div class="navigation-link-option navigation-link-active" id="navigation-link-learn">
              <a href="../../../learn/index.html">Learn</a>
            </div>
            <div class="navigation-link-option" id="navigation-link-forum">
              <a href="../../../forum/index.html">Forum</a>
            </div>
            <div class="navigation-link-option" id="navigation-link-myappinventor">
              <a href="">My Projects</a><div>(coming soon)</div>
            </div>
          </div>
          <div id="navigation-breadcrumb">
            <a href="../../../learn/index.html">Learn</a> &gt; <a href="../../../learn/reference/index.html">Reference</a> &gt; Basic &gt;
          </div>
          <div class="c1"></div>
        </div>
        <div class="customhr customhr-gray"></div>
        <div class="content">
          <div class="content-body">
            <div class="learn-page">
              <h1>
                Basic Components
              </h1>
              <h2>
                Table of Contents
              </h2>
              <ul>
                <li>
                  <a href="#Button">Button</a>
                </li>
                <li>
                  <a href="#Canvas">Canvas</a>
                </li>
                <li>
                  <a href="#CheckBox">CheckBox</a>
                </li>
                <li>
                  <a href="#Clock">Clock</a>
                </li>
                <li>
                  <a href="#Image">Image</a>
                </li>
                <li>
                  <a href="#Label">Label</a>
                </li>
                <li>
                  <a href="#ListPicker">ListPicker</a>
                </li>
                <li>
                  <a href="#PasswordTextBox">PasswordTextBox</a>
                </li>
                <li>
                  <a href="#Screen">Screen</a>
                </li>
                <li>
                  <a href="#TextBox">TextBox</a>
                </li>
                <li>
                  <a href="#TinyDB">TinyDB</a>
                </li>
              </ul>
              <h2 id="Button">
                Button
              </h2><img alt="" src="images/button.png">
              <p>
                Buttons are components that users touch to perform some action in your app.
              </p>
              <p>
                Buttons detect when users tap them. Many aspects of a button's appearance can be changed. You can use the <code>Enabled</code> property to choose whether a button can be tapped.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  Color for button background.
                </dd>
                <dt>
                  <code>Enabled</code>
                </dt>
                <dd>
                  If set, user can tap button to cause action.
                </dd>
                <dt>
                  <code>FontBold</code>
                </dt>
                <dd>
                  If set, button text is displayed in bold.
                </dd>
                <dt>
                  <code>FontItalic</code>
                </dt>
                <dd>
                  If set, button text is displayed in italics.
                </dd>
                <dt>
                  <code>FontSize</code>
                </dt>
                <dd>
                  Point size for button text.
                </dd>
                <dt>
                  <code>FontTypeface</code>
                </dt>
                <dd>
                  Font family for button text.
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dd>
                  Button height (y-size).
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
                <dd>
                  Button width (x-size).
                </dd>
                <dt>
                  <code>Image</code>
                </dt>
                <dd>
                  Image to display on button.
                </dd>
                <dt>
                  <code>Text</code>
                </dt>
                <dd>
                  Text to display on button.
                </dd>
                <dt>
                  <code>TextAlignment</code>
                </dt>
                <dd>
                  Left, center, or right.
                </dd>
                <dt>
                  <code>TextColor</code>
                </dt>
                <dd>
                  Color for button text.
                </dd>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>Click()</code>
                </dt>
                <dd>
                  User tapped and released the button.
                </dd>
                <dt>
                  <code>GotFocus()</code>
                </dt>
                <dd>
                  Button became the focused component.
                </dd>
                <dt>
                  <code>LostFocus()</code>
                </dt>
                <dd>
                  Button stopped being the focused component.
                </dd>
              </dl>
              <h2 id="Canvas">
                Canvas
              </h2><img alt="" src="images/canvas.png">
              <p>
                A two-dimensional touch-sensitive rectangular panel on which drawing can be done and sprites can be moved.
              </p>
              <p>
                The <code>BackgroundColor</code>, <code>PaintColor</code>, <code>BackgroundImage</code>, <code>Width</code>, and <code>Height</code> of the Canvas can be set in either the Designer or in the Blocks Editor. The <code>Width</code> and <code>Height</code> are measured in pixels and must be positive.
              </p>
              <p>
                Any location on the Canvas can be specified as a pair of (X, Y) values, where
              </p>
              <ul>
                <li>X is the number of pixels away from the left edge of the Canvas
                </li>
                <li>Y is the number of pixels away from the top edge of the Canvas
                </li>
              </ul>
              <p>
                There are events to tell when and where a Canvas has been touched or a <code>Sprite</code> (<code>ImageSprite</code> or <code>Ball</code>) has been dragged. There are also methods for drawing points, lines, and circles.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  The color of the canvas background.
                </dd>
                <dt>
                  <code>BackgroundImage</code>
                </dt>
                <dd>
                  The name of a file containing the background image for the canvas
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dt>
                  <code>LineWidth</code>
                </dt>
                <dd>
                  The width of lines drawn on the canvas.
                </dd>
                <dt>
                  <code>PaintColor</code>
                </dt>
                <dd>
                  The color in which lines are drawn
                </dd>
                <dt>
                  <code>Visible</code>
                </dt>
                <dd>
                  Whether the component is visible
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>Dragged(number startX, number startY, number prevX, number prevY, number currentX, number currentY, boolean draggedSprite)</code>
                </dt>
                <dd>
                  When the user does a drag from one point (prevX, prevY) to another (x, y). The pair (startX, startY) indicates where the user first touched the screen, and "draggedSprite" indicates whether a sprite is being dragged.
                </dd>
                <dt>
                  <code>Touched(number x, number y, boolean touchedSprite)</code>
                </dt>
                <dd>
                  When the user touches a canvas, providing the (x, y) position of the touch relative to the upper left corner of the canvas. The value "touchedSprite" is true if a sprite was also in this position.
                </dd>
              </dl>
              <h3>
                Methods
              </h3>
              <dl>
                <dt>
                  <code>Clear()</code>
                </dt>
                <dd>
                  Clears the canvas, without removing the background image, if one was provided.
                </dd>
                <dt>
                  <code>DrawCircle(number x, number y, number r)</code>
                </dt>
                <dd>
                  Draws a circle (filled in) at the given coordinates on the canvas, with the given radius.
                </dd>
                <dt>
                  <code>DrawLine(number x1, number y1, number x2, number y2)</code>
                </dt>
                <dd>
                  Draws a line between the given coordinates on the canvas.
                </dd>
                <dt>
                  <code>DrawPoint(number x, number y)</code>
                </dt>
                <dd>
                  Draws a point at the given coordinates on the canvas.
                </dd>
                <dt>
                  <code>Save()</code>
                </dt>
                <dd>
                  Saves a picture of this Canvas to the device's external storage and returns the full path name of the saved file. If an error occurs the Screen's <code>ErrorOccurred</code> event will be called.
                </dd>
                <dt>
                  <code>SaveAs(text filename)</code>
                </dt>
                <dd>
                  Saves a picture of this Canvas to the device's external storage in the file named fileName. fileName must end with one of ".jpg", ".jpeg", or ".png" (which determines the file type: JPEG, or PNG). Returns the full path name of the saved file.
                </dd>
              </dl>
              <h2 id="CheckBox">
                CheckBox
              </h2><img alt="" src="images/checkbox.png">
              <p>
                Check box components can detect user taps and can change their boolean state in response.
              </p>
              <p>
                A check box component raises an event when the user taps it. There are many properties affecting its appearance that can be set in the Designer or Blocks Editor.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  Color for check box background.
                </dd>
                <dt>
                  <code>Checked</code>
                </dt>
                <dd>
                  True if the box is checked, false otherwise.
                </dd>
                <dt>
                  <code>Enabled</code>
                </dt>
                <dd>
                  If set, user can tap check box to cause action.
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dd>
                  Check box height (y-size).
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
                <dd>
                  Check box width (x-size).
                </dd>
                <dt>
                  <code>Text</code>
                </dt>
                <dd>
                  Text to display on check box.
                </dd>
                <dt>
                  <code>TextColor</code>
                </dt>
                <dd>
                  Color for check box text.
                </dd>
                <dt>
                  <code>Visible</code>
                </dt>
                <dd>
                  If set, check box is visible.
                </dd>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>Click()</code>
                </dt>
                <dd>
                  User tapped and released check box.
                </dd>
                <dt>
                  <code>GotFocus()</code>
                </dt>
                <dd>
                  Check box became the focused component.
                </dd>
                <dt>
                  <code>LostFocus()</code>
                </dt>
                <dd>
                  Check box stopped being the focused component.
                </dd>
              </dl>
              <h2 id="Clock">
                Clock
              </h2><img alt="" src="images/clock.png">
              <p>
                Use a clock component to create a timer that signals events at regular intervals. The clock component also does various conversions and manipulations with time units.
              </p>
              <p>
                One use of the clock component is a a <em>timer</em>: set the timer interval, and the timer will fire repeatedly at the interval, signalling a timer event.
              </p>
              <p>
                A second use of the clock component is to manipulate time, and express time in various units. The internal time format used by the clock is called an <em>instant</em>. The clock's <code>Now</code> method returns the current time as an instant. The clock provides methods to manipulate instants, for example, return an instant that is several seconds, or months, or years from the given instant. It also provides methods to show the second, minute, hour, day, …, corresponding to a given instant.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>TimerInterval</code>
                </dt>
                <dd>
                  timer interval in milliseconds
                </dd>
                <dt>
                  <code>TimerEnabled</code>
                </dt>
                <dd>
                  If true, then the timer will fire
                </dd>
                <dt>
                  <code>TimerAlwaysFires</code>
                </dt>
                <dd>
                  if true, the timer will fire even if the application is not showing on the screen
                </dd>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>Timer()</code>
                </dt>
                <dd>
                  This event is signaled when the timer fires
                </dd>
              </dl>
              <h3>
                Methods
              </h3>
              <dl>
                <dt>
                  <code>SystemTime()</code>
                </dt>
                <dd>
                  The phone's internal time in milliseconds
                </dd>
                <dt>
                  <code>Now()</code>
                </dt>
                <dd>
                  The instant in time read from phone's clock
                </dd>
                <dt>
                  <code>MakeInstant(Text from)</code>
                </dt>
                <dd>
                  Make an instant specified by MM/DD/YYYY hh:mm:ss or MM/DD/YYYY or hh:mm.
                </dd>
                <dt>
                  <code>MakeInstantFromMillis(Number millis)</code>
                </dt>
                <dd>
                  Make an instant specified by time in milliseconds
                </dd>
                <dt>
                  <code>GetMillis(instant)</code>
                </dt>
                <dd>
                  The instant in time measured as milliseconds since 1970
                </dd>
                <dt>
                  <code>AddSeconds(instant, Number seconds)</code>
                </dt>
                <dd>
                  An instant in time some number of seconds after the given instant
                </dd>
                <dt>
                  <code>AddMinutes(instant, Number minutes)</code>
                </dt>
                <dd>
                  An instant in time some number of minutes after the given instant
                </dd>
                <dt>
                  <code>AddHours(instant, Number hours)</code>
                </dt>
                <dd>
                  An instant in time some number of hours after the given instant
                </dd>
                <dt>
                  <code>AddDays(instant, Number days)</code>
                </dt>
                <dd>
                  An instant in time some number of days after the given instant
                </dd>
                <dt>
                  <code>AddWeeks(instant, Number weeks)</code>
                </dt>
                <dd>
                  An instant in time some number of weeks after the given instant
                </dd>
                <dt>
                  <code>AddMonths(instant, Number months)</code>
                </dt>
                <dd>
                  An instant in time some number of months after the given instant
                </dd>
                <dt>
                  <code>AddYears(instant, Number years)</code>
                </dt>
                <dd>
                  An instant in time some number of years after the given instant
                </dd>
                <dt>
                  <code>Duration(Calendar start, Calendar end)</code>
                </dt>
                <dd>
                  Milliseconds between instants
                </dd>
                <dt>
                  <code>Second(Calendar instant)</code>
                </dt>
                <dd>
                  The second of the minute
                </dd>
                <dt>
                  <code>Minute(Calendar instant)</code>
                </dt>
                <dd>
                  The minute of the hour
                </dd>
                <dt>
                  <code>Hour(Calendar instant)</code>
                </dt>
                <dd>
                  The hour of the day
                </dd>
                <dt>
                  <code>DayOfMonth(Calendar instant)</code>
                </dt>
                <dd>
                  The day of the month,a number from 1 to 31
                </dd>
                <dt>
                  <code>Weekday(Calendar instant)</code>
                </dt>
                <dd>
                  The day of the week. a number from 1 (Sunday) to 7 (Saturday)
                </dd>
                <dt>
                  <code>WeekdayName(Calendar instant)</code>
                </dt>
                <dd>
                  The name of the day of the week
                </dd>
                <dt>
                  <code>Month(Calendar instant)</code>
                </dt>
                <dd>
                  The month of the year, a number from 1 to 12)
                </dd>
                <dt>
                  <code>MonthName(Calendar instant)</code>
                </dt>
                <dd>
                  The name of the month
                </dd>
                <dt>
                  <code>Year(Calendar instant)</code>
                </dt>
                <dd>
                  The year
                </dd>
                <dt>
                  <code>FormatDateTime(Calendar instant)</code>
                </dt>
                <dd>
                  Text describing the date and time of an instant
                </dd>
                <dt>
                  <code>FormatDate(Calendar instant)</code>
                </dt>
                <dd>
                  Text describing the date of an instant
                </dd>
                <dt>
                  <code>FormatTime(Calendar instant)</code>
                </dt>
                <dd>
                  Text describing time time of an instant
                </dd>
              </dl>
              <h2 id="Image">
                Image
              </h2><img alt="" src="images/image.png" width="100">
              <p>
                You use image components to represent images that users select and manipulate.
              </p>
              <p>
                An image component displays an image. You can specify the picture to display and other aspects of the image's appearance in the Designer or in the Blocks Editor.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>Picture</code>
                </dt>
                <dd>
                  Picture displayed by this image.
                </dd>
                <dt>
                  <code>Visible</code>
                </dt>
                <dd>
                  If true, image is displayed.
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dd>
                  Image height (y-size).
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
                <dd>
                  Image width (x-size).
                </dd>
              </dl>
              <h2 id="Label">
                Label
              </h2><img alt="" src="images/label.png">
              <p>
                Labels are components used to show text.
              </p>
              <p>
                A label displays text which is specified by the <code>Text</code> property. Other properties, all of which can be set in the Designer or Blocks Editor, control the appearance and placement of the text.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  Color for label background.
                </dd>
                <dt>
                  <code>FontBold</code>
                </dt>
                <dd>
                  If set, label text is displayed in bold.
                </dd>
                <dt>
                  <code>FontItalic</code>
                </dt>
                <dd>
                  If set, label text is displayed in italics.
                </dd>
                <dt>
                  <code>FontSize</code>
                </dt>
                <dd>
                  Point size for label text.
                </dd>
                <dt>
                  <code>FontTypeface</code>
                </dt>
                <dd>
                  Font family for label text.
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dd>
                  Label height (y-size).
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
                <dd>
                  Label width (x-size).
                </dd>
                <dt>
                  <code>Text</code>
                </dt>
                <dd>
                  Text to display on label.
                </dd>
                <dt>
                  <code>TextAlignment</code>
                </dt>
                <dd>
                  Left, center, or right.
                </dd>
                <dt>
                  <code>TextColor</code>
                </dt>
                <dd>
                  Color for label text.
                </dd>
                <dt>
                  <code>Visible</code>
                </dt>
                <dd>
                  If set, label is visible.
                </dd>
              </dl>
              <h2 id="ListPicker">
                ListPicker
              </h2><img alt="" src="images/listpicker.png">
              <p>
                Users tap a list picker component to select one item from a list of text strings.
              </p>When a user taps a list picker, it displays a list of text items for the user to choose from. The text items can be specified through the Designer or Blocks Editor by setting the <code>ElementsFromString</code> property to their comma-separated concatenation (for example, <code>choice 1, choice 2, choice 3</code>) or by setting the <code>Elements</code> property to a <code>List</code> in the Blocks Editor.
              <p>
                Other properties, including <code>TextAlignment</code> and <code>BackgroundColor</code>, affect the appearance of the button and whether it can be tapped (<code>Enabled</code>).
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>Selection</code>
                </dt>
                <dd>
                  Selected list element.
                </dd>
                <dt>
                  <code>Items</code>
                </dt>
                <dd>
                  Comma-separated list of items to display in component.
                </dd>
                <dt>
                  <code>ElementsFromString</code>
                </dt>
                <dd>
                  (Description to come.)
                </dd>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  Color for list picker background.
                </dd>
                <dt>
                  <code>FontBold</code>
                </dt>
                <dd>
                  If set, list picker text is displayed in bold.
                </dd>
                <dt>
                  <code>FontItalic</code>
                </dt>
                <dd>
                  If set, list picker text is displayed in italics.
                </dd>
                <dt>
                  <code>FontSize</code>
                </dt>
                <dd>
                  Point size for list picker text.
                </dd>
                <dt>
                  <code>FontTypeface</code>
                </dt>
                <dd>
                  Font family for list picker text.
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dd>
                  List picker height (y-size).
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
                <dd>
                  List picker width (x-size).
                </dd>
                <dt>
                  <code>Text</code>
                </dt>
                <dd>
                  Title text to display on list picker.
                </dd>
                <dt>
                  <code>TextAlignment</code>
                </dt>
                <dd>
                  Left, center, or right.
                </dd>
                <dt>
                  <code>TextColor</code>
                </dt>
                <dd>
                  Color for list picker text.
                </dd>
                <dt>
                  <code>Visible</code>
                </dt>
                <dd>
                  If set, list picker is visible.
                </dd>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>AfterPicking()</code>
                </dt>
                <dd>
                  User selected an item from the list picker.
                </dd>
                <dt>
                  <code>BeforePicking()</code>
                </dt>
                <dd>
                  User has tapped the list picker but hasn't yet selected an item.
                </dd>
                <dt>
                  <code>GotFocus()</code>
                </dt>
                <dd>
                  List picker became the focused component.
                </dd>
                <dt>
                  <code>LostFocus()</code>
                </dt>
                <dd>
                  List picker is no longer the focused component.
                </dd>
              </dl>
              <h2 id="Screen">
                Screen
              </h2>
              <p>
                The screen does not appear in the palette like other components, but if comes automatically with the project. Each project has exactly one screen, named Screen1. This name cannot be changed.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  Color for screen background.
                </dd>
                <dt>
                  <code>BackgroundImage</code>
                </dt>
                <dd>
                  An image that forms the screen's background.
                </dd>
                <dt>
                  <code class="c2">Height</code>
                </dt>
                <dd>
                  Screen height (y-size).
                </dd>
                <dt>
                  <code>icon</code>
                </dt>
                <dd>
                  An image to be used as the icon for the installed application on the phone. This should be a PNG or a JPG image; 48x48 is a good size. <i>Warning</i>: Specifying images other that PNG or JPG, for example .ico files, may prevent App Inventor from being able to package the application.
                </dd>
                <dt>
                  <code>Scrollable</code>
                </dt>
                <dd>
                  This is set by a checkbox in the designer. When checked, there will be a vertical scrollbar on the screen, and the height of the application can exceed the physical height of the device. When unchecked, the application height is constrained to the height of the device.
                </dd>
                <dt>
                  <code>Title</code>
                </dt>
                <dd>
                  Title for the screen (text). This will appear at the upper left of the phone when the application runs. A natural choice for the title is the title of the App, but you could make it something else, or even change it while the app is running.
                </dd>
                <dt>
                  <code class="c2">Width</code>
                </dt>
                <dd>
                  Screen width (x-size).
                </dd>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>Initialize()</code>
                </dt>
                <dd>
                  Signaled when the application starts. It can be used setting initial values and performing other setup operations.
                </dd>
                <dt>
                  <code>ErrorOccurred(component component, text functionName, number errorNumber, text message)</code>
                </dt>
                <dd>
                  Signaled when an error occurs. The ErrorOccurred event is currently used for a small set of errors including:
                  <ul>
                    <li>Errors that occur in the LEGO MINDSTORMS Nxt* components
                    </li>
                    <li>Errors that occur in the Bluetooth components
                    </li>
                    <li>Errors that occur in the Twitter component
                    </li>
                    <li>Errors that occur in the SoundRecorder component
                    </li>
                    <li>ActivityStarter - when StartActivity is called, but there is no activity that corresponds to the activity properties.
                    </li>
                    <li>LocationSensor - when LatitudeFromAddress or LongitudeFromAddress fails
                    </li>
                    <li>Player - when setting the Source property fails
                    </li>
                    <li>Sound - when setting the Source property fails or when the Play function fails
                    </li>
                    <li>VideoPlayer - when setting the Source property fails
                    </li>
                  </ul>For those errors, the system will show a notification by default, with an error number and a message. You can use this event handler to prescribe an error behavior different than the default, by testing errorNumber and taking the appropriate action.
                </dd>
              </dl>
              <h2 id="PasswordTextBox">
                PasswordTextBox
              </h2><img alt="" src="images/passwordtextbox.png">
              <p>
                Users enter passwords in a password text box component, which hides the text that has been typed in it.
              </p>
              <p>
                A password text box is the same as the ordinary <code>TextBox</code> component, except that it does not display the characters typed by the user.
              </p>
              <p>
                You can get or set the value of the text in the box with the <code>Text</code> property. If <code>Text</code> is blank, you can use the <code>Hint</code> property to provide the user with a suggestion of what to type. The <code>Hint</code> appears as faint text in the box.
              </p>
              <p>
                Password text box components are usually used with a button component. The user taps the button after entering text.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  Color for text box background.
                </dd>
                <dt>
                  <code>Enabled</code>
                </dt>
                <dd>
                  If set, user can enter a password in the box.
                </dd>
                <dt>
                  <code>FontBold</code>
                </dt>
                <dd>
                  If set, text is displayed in bold.
                </dd>
                <dt>
                  <code>FontItalic</code>
                </dt>
                <dd>
                  If set, text is displayed in italics.
                </dd>
                <dt>
                  <code>FontSize</code>
                </dt>
                <dd>
                  Point size for text.
                </dd>
                <dt>
                  <code>FontTypeface</code>
                </dt>
                <dd>
                  Font family for text.
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dd>
                  Box height (y-size).
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
                <dd>
                  Box width (x-size).
                </dd>
                <dt>
                  <code>TextAlignment</code>
                </dt>
                <dd>
                  Left, center, or right.
                </dd>
                <dt>
                  <code>TextColor</code>
                </dt>
                <dd>
                  Color for text.
                </dd>
                <dt>
                  <code>Hint</code>
                </dt>
                <dd>
                  Password hint.
                </dd>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>GotFocus()</code>
                </dt>
                <dd>
                  Box became the focused component.
                </dd>
                <dt>
                  <code>LostFocus()</code>
                </dt>
                <dd>
                  Box is no longer the focused component.
                </dd>
              </dl>
              <h2 id="TextBox">
                TextBox
              </h2><img alt="" src="images/textbox.png">
              <p>
                Users enter text in a text box component.
              </p>
              <p>
                The initial or user-entered text value in a text box component is in the <code>Text</code> property. If <code>Text</code> is blank, you can use the <code>Hint</code> property to provide the user with a suggestion of what to type. The <code>Hint</code> appears as faint text in the box.
              </p>
              <p>
                The <code>MultiLine</code> property determines if the text can have more than one line. For a single line text box, the keyboard will close automatically when the user presses the Done key. To close the keyboard for multiline text boxes, the app should use the HideKeyboard method or rely on the user to press the Back key.
              </p>
              <p>
                The <code>NumbersOnly</code> property restricts the keyboard to accept numeric input only.
              </p>
              <p>
                Other properties affect the appearance of the text box (<code>TextAlignment</code>, <code>BackgroundColor</code>, etc.) and whether it can be used (<code>Enabled</code>).
              </p>
              <p>
                Text boxes are usually used with the <code>Button</code> component, with the user clicking on the button when text entry is complete.
              </p>
              <p>
                If the text entered by the user should not be displayed, use <code>PasswordTextBox</code> instead.
              </p>
              <h3>
                Properties
              </h3>
              <dl>
                <dt>
                  <code>BackgroundColor</code>
                </dt>
                <dd>
                  The background color of the input box. You can choose a color by name in the Designer or in the Blocks Editor. The default background color is 'default' (shaded 3-D look).
                </dd>
                <dt>
                  <code>Enabled</code>
                </dt>
                <dd>
                  Whether the user can enter text into this input box. By default, this is true.
                </dd>
                <dt>
                  <code>FontBold</code> (designer only)
                </dt>
                <dd>
                  Whether the font for the text should be bold. By default, it is not.
                </dd>
                <dt>
                  <code>FontItalic</code> (designer only)
                </dt>
                <dd>
                  Whether the text should appear in italics. By default, it does not.
                </dd>
                <dt>
                  <code>FontSize</code> (designer only)
                </dt>
                <dd>
                  The font size for the text. By default, it is 14.0 points.
                </dd>
                <dt>
                  <code>FontTypeface</code> (designer only)
                </dt>
                <dd>
                  The font for the text. The value can be changed in the Designer.
                </dd>
                <dt>
                  <code>Height</code>
                </dt>
                <dt>
                  <code>Hint</code>
                </dt>
                <dd>
                  Text that should appear faintly in the input box to provide a hint as to what the user should enter. This can only be seen if the <code>Text</code> property is empty.
                </dd>
                <dt>
                  <code>MultiLine</code>
                </dt>
                <dd>
                  If true, then this text box accepts multiple lines of input, which are entered using the return key. For single line text boxes there is a Done key instead of a return key, and pressing Done hides the keyboard. The app should call the HideKeyboard method to hide the keyboard for a mutiline text box.
                </dd>
                <dt>
                  <code>NumbersOnly</code>
                </dt>
                <dd>
                  If true, then this text box accepts only numbers as keyboard input. Numbers can include a decimal point and an optional leading minus sign. This applies to keyboard input only. Even if NumbersOnly is true, you can use [set Text to] to enter any text at all.
                </dd>
                <dt>
                  <code>Text</code>
                </dt>
                <dd>
                  The text in the input box, which can be set by the programmer in the Designer or Blocks Editor, or it can be entered by the user (unless the <code>Enabled</code> property is false).
                </dd>
                <dt>
                  <code>TextAlignment</code> (designer only)
                </dt>
                <dd>
                  Whether the text should be left justified, centered, or right justified. By default, text is left justified.
                </dd>
                <dt>
                  <code>TextColor</code>
                </dt>
                <dd>
                  The color for the text. You can choose a color by name in the Designer or in the Blocks Editor. The default text color is black.
                </dd>
                <dt>
                  <code>Visible</code>
                </dt>
                <dd>
                  Whether the component is visible
                </dd>
                <dt>
                  <code>Width</code>
                </dt>
              </dl>
              <h3>
                Events
              </h3>
              <dl>
                <dt>
                  <code>GotFocus()</code>
                </dt>
                <dd>
                  Event raised when this component is selected for input, such as by the user touching it.
                </dd>
                <dt>
                  <code>LostFocus()</code>
                </dt>
                <dd>
                  Event raised when this component is no longer selected for input, such as if the user touches a different text box.
                </dd>
              </dl>
              <h3>
                Methods
              </h3>
              <dl>
                <dt>
                  <code>HideKeyboard()</code>
                </dt>
                <dd>
                  Hide the keyboard. Only multiline text boxes need this. Single line text boxes close the keyboard when the users presses the Done key.
                </dd>
              </dl>
              <h2 id="TinyDB">
                TinyDB
              </h2>
              <p>
                Use a TinyDB component to store data that will be available each time the app runs.
              </p>
              <p>
                TinyDB is a non-visible component.
              </p>
              <p>
                Apps created with App Inventor are initialized each time they run. If an app sets the value of a variable and the user then quits the app, the value of that variable will not be remembered the next time the app is run. TinyDB is a <em>persistent</em> data store for the app, that is, the data stored there will be available each time the app is run. An example might be a game that saved the high score, and retrieved it each time the game is played.
              </p>
              <p>
                Data items are stored under <em>tags</em>. To store a data item, you specify the tag it should be stored under. Subsequently, you can retrieve the data item that was stored under a given tag. If there is no value stored under a tag, then the value returned is the empty text. Consequently, to see if a tag has a value stored under it, test whether the return value is equal to the empty text (i.e., a text box with no text filled in).
              </p>
              <p>
                There is only one data store per app. If you have multiple TinyDB components, they will use the same data store. To get the effect of separate stores, use different keys. Also each app has its own data store. You cannot use TinyDB to pass data between two different apps on the phone.
              </p>
              <h3>
                Properties
              </h3>none
              <h3>
                Events
              </h3>none
              <h3>
                Methods
              </h3>
              <dl>
                <dt>
                  <code>StoreValue(text tag, valueToStore)</code>
                </dt>
                <dd>
                  Store the value under the given tag. The <code>tag</code> must be a text string; the value can be a string or a list.
                </dd>
                <dt>
                  <code>GetValue(text tag)</code>
                </dt>
                <dd>
                  Gets the value that was stored under the given tag. If no value was stored, returns the empty text.
                </dd>
              </dl>
              <blockquote class="notice">
                <p>
                  To clear out the data base for an app, go on the phone under Settings → Applications → Manage Applications, the pick the app, and press "Clear Data".
                </p>
                <p>
                  The data in TinyDB is persistent only when you have packaged and downloading your app. If you are developing connected to the phone, and you restart the Appinventor application, or if you disconnect and reconnect the phone, then the data base will start fresh. This is a case where the application is not merely being stopped and restarted; it is being removed from the phone and then reloaded.
                </p>
              </blockquote>
            </div>
          </div>
        </div>
        <div class="footer">
          <div class="footer-legal">
            <p>
              <a href="http://creativecommons.org/licenses/by/3.0/" rel="license"><img alt="Creative Commons License" class="c3" src="http://i.creativecommons.org/l/by/3.0/88x31.png"></a><br>
              This work is licensed under a <a href="http://creativecommons.org/licenses/by/3.0/" rel="license">Creative Commons Attribution 3.0 Unported License</a> .
            </p>
            <p>
              The original work by Google has been modified<br>
              <!-- The modified work was translated from English to [language]<br> -->
              <a href="../../../about/index.html">About</a> | <a href="../../../about/privacy.html">Privacy</a> | <a href="../../../about/termsofservice.html">Terms</a>
            </p>
          </div>
          <div class="footer-lastupdate">
            <script type="text/javascript">
if (document.lastModified != '') {
                var m = "Page last updated: " + document.lastModified;
                var p = m.length-8;
                document.writeln("<center>");
                document.write(m.substring(p, 0));
                document.writeln("<\/center>");
              }
            </script>
          </div>
        </div>
      </div>
    </div>
  </body>
</html>
